//
//  NSString+Unicode.m
//  JFBase
//
//  Created by Alan Wang on 2018/12/3.
//  Copyright © 2018 Alan Wang. All rights reserved.
//

#import "NSString+Unicode.h"

@implementation NSString (Unicode)
- (NSString *)unicodeToString{

    
    @autoreleasepool {
            NSString *tempStr1 = [self stringByReplacingOccurrencesOfString:@"\\u" withString:@"\\U"];
            NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
            NSString *tempStr3 = [[@"\"" stringByAppendingString:tempStr2] stringByAppendingString:@"\""];
            NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding];
            NSPropertyListFormat format = NSPropertyListOpenStepFormat;
            NSString *returnStr = [NSPropertyListSerialization propertyListWithData:tempData options:NSPropertyListImmutable format:&format error:nil];
            return [returnStr stringByReplacingOccurrencesOfString:@"\\r\\n" withString:@"\n"];
    }
//    NSString *tempStr1 = [self stringByReplacingOccurrencesOfString:@"\\u" withString:@"\\U"];
//    NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
//    NSString *tempStr3 = [[@"\"" stringByAppendingString:tempStr2] stringByAppendingString:@"\""];
//    NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding];
//    NSPropertyListFormat format = NSPropertyListOpenStepFormat;
//    NSString *returnStr = [NSPropertyListSerialization propertyListWithData:tempData options:NSPropertyListImmutable format:&format error:nil];
//    return [returnStr stringByReplacingOccurrencesOfString:@"\\r\\n" withString:@"\n"];
}
@end
